package groovy.rule.participant

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional
import cn.boxiao.bxn.uic.model.User;
import cn.boxiao.bxn.uic.rule.Rulable;
import cn.boxiao.bxn.uic.rule.participant.Participant;
import cn.boxiao.bxn.uic.service.UserQueryService;

import com.google.common.collect.Lists;

/**
 * Groovy程序，后缀需要改为groovy，并放在指定目录下方可运行
 * @author wxd
 */
@SuppressWarnings("rawtypes")
public class GetCurrentAllHeadTeacherByGradeLevelRule implements Rulable{

    @Autowired
    UserQueryService userService;

    /**
     * @param code ruleId(高中某年级的届学期ID)
     */
    @Override
    @Transactional
    public List<Participant> run(String code) {
        List<Long> uids = new ArrayList<Long>();
        uids.add(1L);
        List<User> users = null;
        try{
            users = userService.findUsersByIds(uids);
        }catch(Exception e){
            e.printStackTrace();
        }
        System.out.println("i am c2 "+"size:"+code+users.size());
        List<Participant> participants = Lists.newArrayList();
        Participant participant = new Participant();
        participant.setParam(2L+"");
        participant.setLabel("李四");
        participants.add(participant);
        return participants;
    }

    @Override
    List<User> echoUsers(List params) {
        return null
    }

    @Override
    List echo(List params) {
        return null
    }
}
